package com.hse.virtualnetwork;

import com.hse.network.IEndDevice;
import com.hse.network.Network;
import com.hse.network.exceptions.NetworkException;
import org.junit.Assert;
import org.junit.Test;

/**
 * Created by IntelliJ IDEA.
 * User: Lexa
 * Date: May 31, 2009
 * Time: 7:06:27 PM
 * To change this template use File | Settings | File Templates.
 */
public class VirtualEndDeviceTester {
    private final static Short PORT_NUMBER = 8789;

    @Test(expected = NetworkException.class)
    public void connect() throws NetworkException {
        IEndDevice endDevice = new VirtualEndDevice();
        endDevice.connect(PORT_NUMBER);
    }

    @Test
    public void scan() throws NetworkException {
        IEndDevice endDevice = new VirtualEndDevice();
        final Network[] networks = endDevice.scan();
        Assert.assertEquals(1, networks.length);
        Assert.assertEquals(PORT_NUMBER, networks[0].getPanId());
    }
}
